import React, { Component } from 'react'
class Child extends Component {
    constructor(props) {
        super(props);
        this.state={
            count:0
        }
    }
    componentWillMount(){
        console.log("will mount");
    }
    componentDidMount(){
        console.log("did mount");
    }
    //其他组件传过来的属性
    componentWillReceiveProps(newProps){
        console.log("will props"+newProps.name);
    }
    shouldComponentUpdate(){
        console.log("should update");
        return true;
    }
    componentWillUpdate(){
        console.log("will update");
    }
    componentDidUpdate(){
        console.log("did update");
    }
    render(){
        return(
            <div>
                <p>子组件接收父组件传过来的值</p>
                <p>{this.props.name}</p>
            </div>
        )
    }

}
export default Child;